from selenium import webdriver
from .login import login_test
from time import sleep
from ..lib.screenshot_function import screenshot
from selenium.webdriver.chrome.options import Options


def open_browser(browser_name, url):
    driver = None
    chrome_options = Options()
    chrome_options.add_argument("--headless")
    chrome_options.add_argument('--no-sandbox')
    chrome_options.add_argument('--disable-dev-shm-usage')
    chrome_options.add_argument('--window-size=1920,1080')
    if browser_name == "chrome":
        driver = webdriver.Chrome(chrome_options=chrome_options)
    if browser_name == "ff":
        driver = webdriver.Firefox()
    if browser_name == "ie":
        driver = webdriver.Ie()
    driver.maximize_window()
    driver.implicitly_wait(10)
    driver.get(url)
    return driver


class TestKeys(object):

    def __init__(self, browser_name, url, username, password, new_password):
        self.driver = open_browser(browser_name, url)
        self.username = username
        self.password = password
        self.new_password = new_password

    def webui1(self, list_dicts):
        # 登录
        driver = login_test(self.username, self.driver, self.new_password)
        # 资产管理
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/div').click()
        sleep(1)
        # 资产一览
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/ul/div/li/span').click()
        sleep(2)
        returns_list = []
        for dicts in list_dicts:
            if dicts["asset_name"] and dicts["principal_name"] and dicts["date_created"] is not None:
                # 资产名称
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[1]/div/div/div/input').send_keys(
                    dicts["asset_name"])
                sleep(2)
                # 负责人名称
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[2]/div/div/div/input').send_keys(
                    dicts["principal_name"])
                sleep(2)
                # 创建日期
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').click()
                sleep(1)
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').send_keys(
                    dicts["date_created"][0])
                sleep(1)
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').click()
                sleep(1)
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').send_keys(
                    dicts["date_created"][1])
                sleep(1)
                # 查询
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[1]').click()
                sleep(2)
                error_text = driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[2]/footer/div/div/slot/span').text
                print(error_text)
                if error_text == "":
                    error_text = driver.find_element_by_xpath(
                        '//*[@id="app"]/section/section/main/section/div/div[2]/main/div/div[3]/div/span').text
                    print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                sleep(2)
                continue
            if dicts["asset_name"] is not None:
                # 资产名称
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[1]/div/div/div/input').send_keys(dicts["asset_name"])
                sleep(2)
                # 查询
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[1]').click()
                sleep(2)
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/footer/div/div/slot/span').text
                print(error_text)
                if error_text == "":
                    error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/main/div/div[3]/div/span').text
                    print(error_text)
                # 重置
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[2]').click()
                sleep(2)
                returns_list.append(error_text)
                driver.refresh()
                sleep(2)
                continue
            if dicts["principal_name"] is not None:
                # 负责人名称
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[2]/div/div/div/input').send_keys(dicts["principal_name"])
                sleep(2)
                # 查询
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[1]').click()
                sleep(2)
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/footer/div/div/slot/span').text
                print(error_text)
                if error_text == "":
                    error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/main/div/div[3]/div/span').text
                    print(error_text)
                # 重置
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[2]').click()
                sleep(2)
                returns_list.append(error_text)
                driver.refresh()
                sleep(2)
                continue
            if dicts["date_created"] is not None:
                # 创建日期
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').click()
                sleep(1)
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').send_keys(dicts["date_created"][0])
                sleep(1)
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').click()
                sleep(1)
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').send_keys(dicts["date_created"][1])
                sleep(1)
                # 查询
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[1]').click()
                sleep(2)
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/footer/div/div/slot/span').text
                print(error_text)
                if error_text == "":
                    error_text = driver.find_element_by_xpath(
                        '//*[@id="app"]/section/section/main/section/div/div[2]/main/div/div[3]/div/span').text
                    print(error_text)
                # 重置
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[2]').click()
                sleep(2)
                returns_list.append(error_text)
                driver.refresh()
                sleep(2)
                continue
        print(returns_list)
        return returns_list

    def webui2(self, list_dicts):
        # 登录
        driver = login_test(self.username, self.driver, self.new_password)
        # 资产管理
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/div').click()
        sleep(1)
        # 资产一览
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/ul/div/li/span').click()
        sleep(2)
        # 资产发现
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/header/div[2]/button[1]').click()
        sleep(2)
        returns_list = []
        for dicts in list_dicts:
            if dicts["asset_name"] and dicts["asset_name_2"] is not None:
                # 资产发现
                driver.find_element_by_xpath(
                    '//*[@id="app"]/section/section/main/section/div/div[2]/header/div[2]/button[1]').click()
                sleep(2)
            if dicts["os"] is not None:
                # 操作系统
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[1]/div/div/div/div/div[1]/input').click()
                sleep(1)
                driver.find_element_by_xpath('/html/body/div[2]/div[1]/div[1]/ul/li[1]').click()
                sleep(2)
            if dicts["asset_name"] is not None:
                # 资产名称
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[2]/div/div/div/div[1]/input').click()
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[2]/div/div/div/div[1]/input').send_keys(dicts["asset_name"])
                sleep(2)
            if dicts["department_name"] is not None:
                # 部门名称
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[3]/div/div/div/div[1]/input').send_keys(dicts["department_name"])
                sleep(2)
            if dicts["principal_name"] is not None:
                # 负责人名称
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[4]/div/div/div/div[1]/input').send_keys(dicts["principal_name"])
                sleep(2)
            # 描述
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[5]/div/div/div/div/textarea').send_keys("资产描述测试1")
            sleep(2)
            # 下一步
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[2]/button').click()
            sleep(2)
            if dicts["asset_name"] == dicts["asset_name_2"]:
                alert_text = driver.find_element_by_xpath('/html/body/div[3]/p').text
                print(alert_text)
                returns_list.append(alert_text)
                driver.refresh()
                continue
            if dicts["os"] is None:
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[1]/div/div/div/div[2]').text
                print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                continue
            if dicts["asset_name"] is None:
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[2]/div/div/div/div[2]').text
                print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                continue
            if dicts["department_name"] is None:
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[3]/div/div/div/div[2]').text
                print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                continue
            if dicts["principal_name"] is None:
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[4]/div/div/div/div[2]').text
                print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                continue
            if len(dicts["asset_name"]) > 32:
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[2]/div/div/div/div[2]').text
                print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                continue
            if len(dicts["department_name"]) > 32:
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[3]/div/div/div/div[2]').text
                print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                continue
            if len(dicts["principal_name"]) > 32:
                error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/form/div[4]/div/div/div/div[2]').text
                print(error_text)
                returns_list.append(error_text)
                driver.refresh()
                continue

            # 开始ip
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[1]/div/div/div/input').send_keys("192.168.50.2111")
            sleep(1)
            # 结束ip
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[3]/div/div/div/input').send_keys("192.168.50.2155")
            sleep(1)
            try:
                # 判断是否输入正确的IP地址
                text1 = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[1]/div/div/div[2]').text
                print(text1)
                if text1 == "请输入正确的IP地址":
                    driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[1]/div/div/div/input').clear()
                    driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[1]/div/div/div/input').send_keys("192.168.50.211")
                    sleep(1)
            except Exception as a:
                print(a)
            try:
                text2 = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[3]/div/div/div[2]').text
                print(text2)
                if text2 == "请输入正确的IP地址":
                    driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[3]/div/div/div/input').clear()
                    driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[3]/div/div/div/input').send_keys("192.168.50.215")
                    sleep(1)
            except Exception as a:
                print(a)
            # 批量添加
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[1]/form/div/div[4]/button').click()
            sleep(2)
            # 全选
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[2]/table/thead/tr/th[1]/div/label/span').click()
            sleep(1)
            # 批量设置
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[2]/button[1]').click()
            sleep(1)
            # 用户名称
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[4]/div/div[2]/div/form/div[1]/div/div/div/div/input').send_keys("root")
            sleep(1)
            # 密码
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[4]/div/div[2]/div/form/div[2]/div/div/div/div/input').send_keys("idss@1234")
            sleep(1)
            # 端口
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[4]/div/div[2]/div/form/div[3]/div/div/div/div/input').send_keys("22")
            sleep(1)
            # 保存
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[4]/div/div[2]/div/div/button[2]').click()
            sleep(2)
            # 选中
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[3]/table/tbody/tr[1]/td[1]/div/label/span').click()
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[3]/table/tbody/tr[2]/td[1]/div/label/span').click()
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[3]/table/tbody/tr[3]/td[1]/div/label/span').click()
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[3]/table/tbody/tr[4]/td[1]/div/label/span').click()
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[3]/table/tbody/tr[5]/td[1]/div/label/span').click()
            sleep(1)
            # 筛选重复ip
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[2]/button[3]').click()
            sleep(1)
            # 选中
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[3]/table/tbody/tr[1]/td[1]/div/label/span').click()
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/form/div/div[3]/table/tbody/tr[2]/td[1]/div/label/span').click()
            # 批量删除
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[1]/div[2]/button[4]').click()
            sleep(1)
            # 确认删除
            driver.find_element_by_xpath('/html/body/div[2]/div/div[3]/button[2]').click()
            sleep(2)
            # 下一步
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[3]/button[2]').click()
            sleep(1)
            # 信息提示-继续
            driver.find_element_by_xpath('/html/body/div[2]/div/div[3]/button[2]').click()
            sleep(15)
            try:
                # 正常
                driver.find_element_by_xpath('//*[@id="tab-first"]').click()
                # 截图
                screenshot(driver)
                sleep(2)
                # 有延迟
                driver.find_element_by_xpath('//*[@id="tab-second"]').click()
                # 截图
                screenshot(driver)
                sleep(2)
                # 异常
                driver.find_element_by_xpath('//*[@id="tab-third"]').click()
                # 截图
                screenshot(driver)
                sleep(2)
                # 保存
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div/main/div[2]/div[3]/button[2]').click()
                sleep(6)
                driver.refresh()
                # 资产名称
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[1]/div/div/div/input').send_keys(dicts["asset_name"])
                sleep(2)
                # 查询
                driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[1]').click()
                returns_list.append("新增成功")
            except Exception as a:
                screenshot(driver)
                returns_list.append(("执行失败%s" % a))
        print(returns_list)
        return returns_list

    def webui3(self, username):
        # 登录
        driver = login_test(username, self.driver, self.new_password)
        # 资产管理
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/div').click()
        sleep(1)
        # 资产一览
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/ul/div/li/span').click()
        sleep(2)
        # 明细
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/main/div/div[3]/table/tbody/tr[1]/td[9]/div/button[1]').click()
        sleep(2)
        # ip信息
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/div[2]/div/div/div/div/input').send_keys("192.168.50.213")
        # 查询
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/button[1]').click()
        sleep(1)
        # 重置
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/button[2]').click()
        sleep(1)
        # 搜索类型
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/div[1]/div/div/div/div[1]/span/span').click()
        driver.find_element_by_xpath('/html/body/div[5]/div[1]/div[1]/ul/li[2]').click()
        sleep(1)
        # ip段-头
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/div[2]/div[1]/div/div/div/input').send_keys("192.168.50.213")
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/div[2]/div[3]/div/div/div/input').send_keys("192.168.50.215")
        # 查询
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/button[1]').click()
        sleep(1)
        # 重置
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[3]/main/div[1]/form/div/button[2]').click()
        sleep(2)
        # 返回
        driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[1]/header/div[2]/a/button').click()
        sleep(3)

        return "执行成功"

    def webui4(self, list_dicts):
        # 登录
        driver = login_test(self.username, self.driver, self.new_password)
        # 资产管理
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/div').click()
        sleep(1)
        # 资产一览
        driver.find_element_by_xpath('//*[@id="app"]/section/section/aside/div/ul/div/li[2]/ul/div/li/span').click()
        sleep(2)
        returns_list = []
        for dicts in list_dicts:
            # 资产名称
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[1]/div/div/div/input').send_keys(
                dicts["asset_name"])
            sleep(2)
            # 负责人名称
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[2]/div/div/div/input').send_keys(
                dicts["principal_name"])
            sleep(2)
            # 创建日期
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').click()
            sleep(1)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').send_keys(
                dicts["date_created"][0])
            sleep(1)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').click()
            sleep(1)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').send_keys(
                dicts["date_created"][1])
            sleep(1)
            # 查询
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[1]').click()
            sleep(2)
            # 删除
            driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/main/div/div[3]/table/tbody/tr/td[9]/div/button[2]').click()
            sleep(1)
            # 确定
            driver.find_element_by_xpath(
                '/html/body/div[7]/div/div[3]/button[2]').click()
            sleep(1)
            # 重置
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[2]').click()
            sleep(2)
            # 资产名称
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[1]/div/div/div/input').send_keys(
                dicts["asset_name"])
            sleep(2)
            # 负责人名称
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[2]/div/div/div/input').send_keys(
                dicts["principal_name"])
            sleep(2)
            # 创建日期
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').click()
            sleep(1)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[1]').send_keys(
                dicts["date_created"][0])
            sleep(1)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').click()
            sleep(1)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[3]/div/div/div/input[2]').send_keys(
                dicts["date_created"][1])
            sleep(1)
            # 查询
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[1]').click()
            sleep(2)
            error_text = driver.find_element_by_xpath('//*[@id="app"]/section/section/main/section/div/div[2]/main/div/div[3]/div/span').text
            print(error_text)
            if error_text == "暂无数据":
                returns_list.append("删除成功")
            else:
                returns_list.append("删除失败")
            # 重置
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/section/main/section/div/div[1]/main/div/main/form/div/div[4]/button[2]').click()
            continue
        print(returns_list)
        return returns_list

    def quit(self):
        """
        浏览器退出
        :return:
        """
        self.driver.quit()